﻿using System.Collections.Generic;
using System.Text;

namespace Wicture.QPZS.EPC.Models
{
    public class ZsTokenDict
    {
        public string Token { get; set; }
        private ZsTokenDict()
        {

        }
        private static ZsTokenDict _instance;

        public static ZsTokenDict Instance => _instance ?? (_instance = new ZsTokenDict());
    }
    public class ZsToken
    {
        public string msg { get; set; }
        public int code { get; set; }
    }
    public class EngineTransissionOil
    {
        public string transmissionOilPartName { get; set; }
        public string partCode { get; set; }
        public string transmissionOilType { get; set; }
        public string dosageLiter { get; set; }
        public string transmissionType { get; set; }
        public string transmissionOilDosage { get; set; }
        public string composition { get; set; }
        public string partName { get; set; }
        public string viscosity { get; set; }
        public string manufacturerPrice { get; set; }
        public string level { get; set; }
    }

    public class ModelInfo
    {
        public string tModelSOP { get; set; }
        public string manufacturer { get; set; }
        public string power { get; set; }
        public string serieEOP { get; set; }
        public string driveType { get; set; }
        public string serieSOP { get; set; }
        public string tModelEOP { get; set; }
        public string tModelId { get; set; }
        public string brand { get; set; }
        public string engine { get; set; }
        public string tModelName { get; set; }
        public string displacement { get; set; }
        public string tId { get; set; }
        public string modelYear { get; set; }
        public string modelName { get; set; }
        public string tTypeName { get; set; }
        public string transmission { get; set; }
        public string modelSerie { get; set; }
    }

    public class BrakingAndCoolingOil
    {
        public string partCode { get; set; }
        public string dosageLiter { get; set; }
        public string partName { get; set; }
        public string level { get; set; }
        public string color { get; set; }
        public string oesPrice { get; set; }
        public string iceTemperature { get; set; }
    }

    public class MaintenanceInfo
    {
        public string partName { get; set; }
        public string maintenanceMonth { get; set; }
        public string manHourCost { get; set; }
        public string partCode { get; set; }
        public string OESPrice { get; set; }
        public string partType { get; set; }
        public string manHour { get; set; }
        public string maintenanceMileage { get; set; }
        public string manHourPrice { get; set; }
    }

    public class PartCompare:IEqualityComparer<MaintenanceInfo>
    {
        public bool Equals(MaintenanceInfo x, MaintenanceInfo y)
        {
            return x.partName == y.partName;
        }

        public int GetHashCode(MaintenanceInfo obj)
        {
            return obj.partName.GetHashCode();
        }
    }

    public class ZsMaintainpart
    {
        public List<EngineTransissionOil> engineTransissionOil { get; set; }
        public ModelInfo modelInfo { get; set; }
        public List<BrakingAndCoolingOil> brakingAndCoolingOil { get; set; }
        public List<MaintenanceInfo> maintenanceInfo { get; set; }
    }


    public class CommonPart
    {
        public string partCode { get; set; }
        public string partName { get; set; }
        public string type { get; set; }
        public string usage { get; set; }
        public string maintainPrice { get; set; }
        public string oesPrice { get; set; }

        public string level { get; set; }
        public string color { get; set; }        
        public string iceTemperature { get; set; }
        public string transmissionOilType { get; set; }
        public string transmissionType { get; set; }
        public string composition { get; set; }
        public string viscosity { get; set; }

        public string description { get; set; }

        public bool isSelected { get; set; }

        public void BuildDescription()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(string.IsNullOrEmpty(this.partCode) ? "" : $"OE号：{this.partCode}，");
            sb.Append(string.IsNullOrEmpty(this.composition) ? "" : $"油品成分：{this.composition}，");
            sb.Append(string.IsNullOrEmpty(this.level) ? "" : $"油品等级：{this.level}，");
            sb.Append(string.IsNullOrEmpty(this.viscosity) ? "" : $"粘度级别：{this.viscosity}，");
            sb.Append(string.IsNullOrEmpty(this.color) ? "" : $"颜色：{this.color}，");
            sb.Append(string.IsNullOrEmpty(this.iceTemperature) ? "" : $"冰点：{this.iceTemperature}，");
            sb.Append(string.IsNullOrEmpty(this.transmissionType) ? "" : $"变速箱类型：{this.transmissionType}，");
            sb.Append(string.IsNullOrEmpty(this.transmissionOilType) ? "" : $"变速箱油类型：{this.transmissionOilType}");
            this.description = sb.ToString();
        }
    }


    public class NoVinPart
    {
        public string partName { get; set; }
        public string partCode { get; set; }
        public string partType { get; set; }
        public int maintainDistance { get; set; }
        public int maintainSpan { get; set; }
    }
}
